/*
  将下面异步代码使用 Promise 的方法改进
  尽量用看上去像同步代码的方式
  setTimeout(function () {
    var a = 'hello'
    setTimeout(function () {
      var b = 'lagou'
      setTimeout(function () {
        var c =
        console.log(a + b +c)
      }, 10)
    }, 10)
  }, 10)
*/


const wait_for_ten = (str) => {
  return new Promise((resolve) => {
    setTimeout(() => {
      resolve(str);
    }, 1000)
  })
}

async function main() {
  let a = await wait_for_ten('hello');
  let b = await wait_for_ten('lagou');
  wait_for_ten(a + b + 'I ♥ U').then(str => console.log(str));
}

main();
